import request from '@/router/axios'

//  获取仓位列表
export function getStockList(query) {
  return request({
    url: '/eims/stock/list',
    method: 'get',
    params: query
  })
}

//  获取仓位分页数据
export function fetchStockList(query) {
  return request({
    url: '/eims/stock/page',
    method: 'get',
    params: query
  })
}

//  添加新增仓位
export function addStockObj(obj) {
  return request({
    url: '/eims/stock',
    method: 'post',
    data: obj
  })
}

//  根据ID查询仓位信息
export function getStockObj(id) {
  return request({
    url: '/eims/stock/' + id,
    method: 'get'
  })
}

//  根据ids获取仓位集合
export function getListByIds(ids) {
  return request({
    url: '/eims/stock/getListByIds',
    method: 'get',
    params: ids
  })
}

//  根据ID删除仓位信息
export function delStockObj(id) {
  return request({
    url: '/eims/stock/' + id,
    method: 'delete'
  })
}

//  修改更新仓位信息
export function putStockObj(obj) {
  return request({
    url: '/eims/stock',
    method: 'put',
    data: obj
  })
}

//  根据部门id获取仓库列表
export function getStockInfo(deptId) {
  return request({
    url: '/eims/stock/info/' + deptId,
    method: 'get'
  })
}

//根据部门类型获取对应仓位
export function getStockByDeptTypes(stockTypes) {
  return request({
    url: '/eims/stock/getStockList/stockTypes',
    method: 'get',
    params: stockTypes
  })
}
